package com.mingshashan.building.easy.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mingshashan.building.easy.core.validation.EasyValidationGroups;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * BaseEntity
 *
 * @author jasonxu
 * @Description TODO
 */
@Data
public abstract class BaseEntity implements Serializable {

    @NotBlank(groups = {EasyValidationGroups.Create.class})
    @NotBlank(groups = {EasyValidationGroups.Update.class})
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    @NotBlank(groups = {EasyValidationGroups.Create.class})
    @NotBlank(groups = {EasyValidationGroups.Update.class})
    private String code;

    protected String createdBy;

    protected String lastModifiedBy;

    protected Date createdDate = new Date();

    protected Date lastModifiedDate = new Date();
}
